<?php

namespace App\Listeners;

use App\Events\PersonSaving;
use App\Person;
use Illuminate\Events\Dispatcher;
use Illuminate\Support\Facades\Log;

class PersonEventSubscriber
{
    /**
     * @param $event Person
     */
    public function onPersonSaving(Person $event)
    {
        Log::info('PersonEventSubscriber 用户 delete[' . $event->person->id . ']:' . $event->person->name);
    }

    /**
     * @param $events
     */
    public function subscribe(Dispatcher $events)
    {
        $events->listen(
            PersonSaving::class,
            static::class . '@onPersonSaving'
        );
    }

}
